﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Permission.BLL;

namespace WebSite.admin.groups
{
    public partial class groupedit : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id = int.Parse(Request["id"]);
                Groups gbll = new Groups();
                Groups.GroupInfo vInfo = gbll.GetGroupInfo(id);

                this.GroupEdit_groupid.Value = vInfo.GroupID.ToString();
                this.GroupEdit_groupname.Value = vInfo.GroupName;
                this.GroupEdit_groupdescription.Value = vInfo.GroupDescription;
            }
            else
            {
                Groups.GroupInfo info = new Groups.GroupInfo();
                info.GroupID = int.Parse(Request.Form["GroupEdit_groupid"]);
                info.GroupName = Request.Form["GroupEdit_groupname"];
                info.GroupDescription = Request.Form["GroupEdit_groupdescription"];

                Groups gbll = new Groups();
                gbll.UpdateGroupInfo(info);
                Response.End();
            }
        }
    }
}